﻿
using System.Collections.Generic;
using System.Web.UI.WebControls;
using BIS.Portal.Core.Entity;
using BIS.Portal.Core.Global;

namespace BIS.Portal.Modules.CMS.Adm
{
    public class AdminPageAliasManagement
    {
        public static void BindPageList(string pageName, DropDownList ddlPage)
        {

            Dictionary<string, FullPageSiteEntity> listPage = new Dictionary<string, FullPageSiteEntity>();
            PortalContext.GetPageList(0, ref listPage, "", false);

            ddlPage.Items.Clear();
            foreach (KeyValuePair<string, FullPageSiteEntity> pair in listPage)
            {
                if (pair.Value.PageAlias != PortalContext.PageAlias)
                {
                    ddlPage.Items.Add(new ListItem(pair.Key, pair.Value.PageAlias));
                }
            }
            if (!string.IsNullOrEmpty(pageName))
            {
                pageName = pageName.Replace(".", "");
                ddlPage.SelectedValue = pageName;
            }
        }
    }
}